package com.example.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author renyitong
 * @version 1.0.0
 * @createTime 2025年06月27日
 * @Description
 */
@Service
public class CaseService {

    @Autowired
    private CaseHandlerFactory factory;

    public void handleCase(String caseType, String caseId) {
        CaseContext caseContext = new CaseContext(caseType, caseId);
        factory.getHandler(caseContext)
                .ifPresent(handler -> handler.processor().process(caseContext));
    }

}
